#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <sstream>

using namespace std;

template<class _Cty,class _Ty>
std::vector<_Ty> split(std::basic_string<_Cty>& str,const char delim,const _Ty& constructor)
{

	std::basic_stringstream<_Cty> transfert;

	std::vector<_Ty> ret;

	_Ty recup = _Ty();
	
	unsigned int nb_word = 0;
	unsigned int pos = 0;

	while((pos = str.find(delim,pos+1)) != string::npos)
	{
		str.at(pos) = ' ';
		nb_word++;
	}

	transfert<<str;

	for(unsigned int i=0;i<nb_word;i++)
	{
		transfert>>recup;
		ret.push_back(recup);
	}
	
	if(ret.size() > nb_word)
		ret.pop_back();
	
	return ret;
}